from appium import webdriver
from appium.webdriver.common.appiumby import By
from small_big import *
from time import sleep
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '7'
desired_caps['deviceName'] = '127.0.0.1:62001'
desired_caps['app'] = r'E:\nmon\apk\gaodemap.apk' # pc端的apk包所在的路径
desired_caps['appPackage'] = r'com.autonavi.minimap'
desired_caps['appActivity'] = r'com.autonavi.map.activity.SplashActivity'
desired_caps['noReset'] = False  # False代表重置（重新安装），默认值就是False

driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
driver.implicitly_wait(10)  # 隐式等待
sleep(3)


# 进入主界面
driver.find_element(By.ID,'com.autonavi.minimap:id/agree').click()
# 搜索框在下方
driver.find_element(By.ID,'com.autonavi.minimap:id/rb_search_bottom').click()
# 点击进入下图
driver.find_element(By.ID,'com.autonavi.minimap:id/enter_amap').click()
# 允许定位
driver.find_element(By.ID,'com.android.packageinstaller:id/permission_allow_button').click()
# 不允许自己更新
driver.find_element(By.ID,'com.autonavi.minimap:id/map_widget_container').click()
smaller(driver)
sleep(5)

driver.quit()